package 力扣._00周赛._414周赛.问题1;

import java.util.List;

public class Solution {
    // 做复杂了，这个不用动规，贪心即可
    public long findMaximumScore(List<Integer> nums) {
        long[] dp = new long[nums.size()];
        // dp[j] = max(dp[i] + (j-i) * nums[i])
        for (int i = 1; i < nums.size(); i++) {
            for (int j = 0; j < i; j++) {
                dp[i] = Math.max(dp[i], dp[j] + (long) (i - j) * nums.get(j));
            }
        }
        return dp[nums.size() - 1];
    }
}
